package addon.w3.mdx.com;

import java.io.IOException;

import addon.w3.mdx.LEDataInputStream;
import addon.w3.mdx.MDXException;
import addon.w3.mdx.MDXParentCOM;

public class MDXTextureID extends MDXParentCOM {
	int nunks = -1;
	int lineType = -1;
	int globalSeqID = -1;
		
	MDXAlphaCOM mdcoms[] = null;
	
	public String getTag() {
		return "KMTF";
	}
	
	public void _decode(LEDataInputStream ins) throws IOException, MDXException {
		nunks = ins.readInt();
		lineType = ins.readInt();
		globalSeqID = ins.readInt();
		mdcoms = new MDXAlphaCOM[nunks];
		for (int i = 0; i < mdcoms.length; i++) {
			mdcoms[i] = new MDXAlphaCOM("KMTF:TextureID",lineType);
			mdcoms[i].decode(ins);
		}
	}
		
	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append("TAG : "+getTag());
		sb.append("\n\tNUNKS : "+nunks);
		sb.append("\n\tLINETYPE : "+lineType);
		sb.append("\n\tGLOBALSEQID : "+globalSeqID);
		if(mdcoms != null && mdcoms.length > 0) sb.append("\n\tALPHA[] : "+mdcoms.length);
		return sb.toString();
	}

	@Override
	public boolean isImplicitTag() {
		// TODO Auto-generated method stub
		return false;
	}
}